Skip to content

[frontend] chore(deps): update dependency react-grid-layout to v2#4588

Merged
damgouj merged 2 commits intomasterfrom
renovate/react-grid-layout-2.x
Feb 27, 2026
Merged

[frontend] chore(deps): update dependency react-grid-layout to v2#4588
damgouj merged 2 commits intomasterfrom
renovate/react-grid-layout-2.x

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Dec 17, 2025

This PR contains the following updates:

Package Change Age Confidence
react-grid-layout (source) 1.5.32.2.2 age confidence
@​types/react-grid-layout ^1^2.0.0 age confidence

Release Notes

STRML/react-grid-layout (react-grid-layout)

v2.2.2

Compare Source

🧪 Tests

🔧 Internal Changes

v2.2.1

Compare Source

Bug Fixes
  • Drag position: Fix items jumping half a screen down when drag starts on a grid container offset from the page top. Removed calcDragPosition from default position strategies since react-draggable handles parent-relative coordinates correctly. #​2223
  • Compactor: Ensure all internal v2 code uses compactor.compact() instead of the legacy compact() function. Added optional compactor prop to hooks (useGridLayout, useResponsiveLayout) that takes precedence over compactType/allowOverlap. Fixed negative coordinate handling in compactors. #​2222, fixes #​2213
  • Drag-from-outside: Add defensive guards for edge cases with drag enter/leave counter synchronization. Made removeDroppingPlaceholder idempotent and prevented negative counter values. #​2220, fixes #​2210
Internal Changes
  • Removed never-exported compat layers (utils-compat.ts, responsive-compat.ts, calculate-compat.ts). These were internal implementation details and were never part of the public API.
  • Removed onMove() method from Compactor interface. Custom compactors should implement only compact().

v2.2.0

Compare Source

v2.1.1

Compare Source

Bug Fixes
  • Legacy API: Fix allowOverlap not working in legacy mode. Added noOverlapCompactor for when compactType=null and allowOverlap=true. #​2207
  • GridLayout: Fix "Maximum update depth exceeded" during drag/resize/drop operations. Used layoutRef pattern to prevent callbacks from being recreated on every layout change. #​2208
  • useResponsiveLayout: Fix infinite re-render loop when passing inline objects as layouts prop. Added separate ref to track props vs state changes. #​2209

v2.1.0

Compare Source

New Features
Pluggable Layout Constraints System

A new constraints system allows custom validation and transformation of layout items during drag and resize operations. #​2190

import { createConstraintEnforcer, aspectRatioConstraint, positionConstraint } from "react-grid-layout/core";

const enforcer = createConstraintEnforcer([
  aspectRatioConstraint(16 / 9),
  positionConstraint({ minX: 0, maxX: 10 })
]);

<GridLayout constraintEnforcer={enforcer} />
Fast Compactors for Large Layouts

New O(n log n) compactors in react-grid-layout/extras for layouts with 200+ items:

  • fastVerticalCompactor - Up to 45x faster than standard vertical compaction. #​2184
  • fastHorizontalCompactor - Up to 74x faster than standard horizontal compaction. #​2189, #​2193
import { fastVerticalCompactor, fastHorizontalCompactor } from "react-grid-layout/extras";

<GridLayout compactor={fastVerticalCompactor} />
Wrap Compactor

New wrapCompactor for paragraph-style layouts where items flow left-to-right and wrap to the next row. #​2186

import { wrapCompactor } from "react-grid-layout/extras";

<GridLayout compactor={wrapCompactor} />
Improved Examples
  • Added navigable sidebar to examples for easier exploration
  • New grid matrix panel for visualizing layout state. #​2197
Bug Fixes
  • WidthProvider: Re-observe element after measureBeforeMount switches from placeholder. #​2198
  • Drop positioning: Center dropped items on cursor position instead of top-left corner. #​2196
  • Margin calculation: Ensure consistent margins between grid items. #​2195
  • Compaction: Disable early break optimization when static items are present, fixing incorrect layouts. #​2194
  • Responsive layouts: Prevent infinite layout oscillation in toolbox pattern. #​2192
  • CSS: Remove user-select: none from grid items to restore auto-scroll behavior. #​2188
Tests
  • Added maxRows enforcement tests for calcXY and calcWH. #​2185
Internal Changes
  • Improved changelog action for better automated release notes. #​2199

v2.0.0

Compare Source

Version 2 is a complete TypeScript rewrite with a modernized hooks-based API. See the RFC for the full design document.

Highlights
  • Full TypeScript support - First-class types, no more @types/react-grid-layout needed
  • React Hooks API - New useContainerWidth, useGridLayout, and useResponsiveLayout hooks
  • Composable Configuration - Group related props into focused interfaces (gridConfig, dragConfig, resizeConfig, positionStrategy, compactor)
  • Modular Architecture - Tree-shakeable ESM and CJS builds with multiple entry points
  • Legacy Compatibility - 100% backwards compatible via react-grid-layout/legacy
Breaking Changes

See the migration section in the README for detailed examples.

width Prop Required

The grid no longer auto-measures width. Use the new useContainerWidth hook:

import ReactGridLayout, { useContainerWidth } from "react-grid-layout";

function MyGrid() {
  const { width, containerRef, mounted } = useContainerWidth();
  return (
    <div ref={containerRef}>
      {mounted && <ReactGridLayout width={width} ... />}
    </div>
  );
}

Or use the legacy wrapper for backwards compatibility:

import ReactGridLayout, { WidthProvider } from "react-grid-layout/legacy";
const GridLayoutWithWidth = WidthProvider(ReactGridLayout);
onDragStart Threshold

onDragStart now fires after 3px of mouse movement, not on mousedown. This fixes #​1341 and #​1401. Use onMouseDown directly on grid items if you need immediate response.

Immutable Callback Parameters

Callback parameters (layoutItem, placeholder) are now read-only. Mutating them in onResize/onDrag callbacks no longer works. Use onLayoutChange or item constraints (minW, maxW, etc.) instead.

data-grid Prop in Legacy Only

The v2 API requires explicit layout prop. The data-grid pattern is only available via the legacy wrapper (react-grid-layout/legacy).

Pluggable Compaction Algorithms

Compaction is now pluggable via the Compactor interface. The default compaction algorithm remains the same as v1 for backwards compatibility. For large layouts (200+ items), an optional O(n log n) fast compactor is available in react-grid-layout/extras:

import { fastVerticalCompactor } from 'react-grid-layout/extras';
<GridLayout compactor={fastVerticalCompactor} />
Other Breaking Changes
  • UMD bundle removed - Use a bundler (Vite, webpack, esbuild)
  • verticalCompact prop removed - Use compactType={null} or compactor={noCompactor}
  • React 18+ required - React 16/17 support is available only via the legacy wrapper
New Features
Entry Points
// v2 API (recommended)
import ReactGridLayout, {
  Responsive,
  useContainerWidth
} from "react-grid-layout";

// Core utilities (framework-agnostic, no React)
import { compact, moveElement, collides } from "react-grid-layout/core";

// Legacy v1 API (100% backwards compatible)
import ReactGridLayout, {
  WidthProvider,
  Responsive
} from "react-grid-layout/legacy";

// Optional extras
import { GridBackground } from "react-grid-layout/extras";
Hooks
  • useContainerWidth() - Reactive container width measurement with ResizeObserver
  • useGridLayout() - Core layout state management for custom implementations
  • useResponsiveLayout() - Responsive breakpoint management
Composable Configuration Interfaces
<ReactGridLayout
  width={width}
  layout={layout}
  gridConfig={{ cols: 12, rowHeight: 30, margin: [10, 10] }}
  dragConfig={{ enabled: true, handle: ".handle", bounded: true }}
  resizeConfig={{ enabled: true, handles: ["se", "sw"] }}
  positionStrategy={transformStrategy}
  compactor={verticalCompactor}
/>
Pluggable Compactors

Create custom compaction algorithms by implementing the Compactor interface:

import {
  verticalCompactor,
  horizontalCompactor,
  noCompactor
} from "react-grid-layout/core";

// Or create custom compactors
const myCompactor: Compactor = {
  type: "custom",
  allowOverlap: false,
  compact(layout, cols) {
    /* ... */
  },
  onMove(layout, item, x, y, cols) {
    /* ... */
  }
};
Position Strategies

Control CSS positioning with the PositionStrategy interface:

import { transformStrategy, absoluteStrategy, createScaledStrategy } from "react-grid-layout/core";

// For scaled containers
<div style={{ transform: "scale(0.5)" }}>
  <ReactGridLayout positionStrategy={createScaledStrategy(0.5)} />
</div>
GridBackground Component

New optional component to visualize the grid structure:

import { GridBackground } from "react-grid-layout/extras";

<GridBackground
  width={width}
  cols={12}
  rowHeight={30}
  rows={10}
  color="#f0f0f0"
/>;
Core Utilities

New calcGridCellDimensions utility for building custom grid overlays:

import { calcGridCellDimensions } from "react-grid-layout/core";

const dims = calcGridCellDimensions({
  width: 1200,
  cols: 12,
  rowHeight: 30,
  margin: [10, 10]
});
// { cellWidth, cellHeight, offsetX, offsetY, gapX, gapY, cols, containerWidth }
React 18 Compatibility
  • Full React 18 support. The library now works seamlessly with React 18's automatic batching without any flushSync warnings.
  • Removed flushSync usage from drag and resize handlers.
Bugfixes
  • Fixed operator precedence bug in moveDroppingItem where shouldDrag would incorrectly evaluate to true when only the top position changed.
  • Fixed resize position calculation when node is falsy in onResizeHandler.
Internal Changes
  • Complete TypeScript rewrite - All code is now TypeScript with full type coverage
  • Migrated from Flow to TypeScript - Removed all Flow annotations
  • Modular package structure - src/core/ (pure TS), src/react/ (React bindings), src/legacy/ (v1 compatibility)
  • Build system - Now uses tsup for ESM, CJS, and declaration file generation
  • Migrated test suite from Enzyme to React Testing Library
  • ESLint 9 with flat config
  • Removed lib/ folder and Flow configuration
  • Removed snapshot tests in favor of behavioral tests
Migration Guide

Quick migration (no code changes):

- import GridLayout from 'react-grid-layout';
+ import GridLayout from 'react-grid-layout/legacy';

Full migration (recommended for new features):

  1. Replace WidthProvider HOC with useContainerWidth hook
  2. Replace data-grid props with explicit layout prop
  3. Use configuration interfaces (gridConfig, dragConfig, etc.) for cleaner props
  4. Update any code that mutates callback parameters to use onLayoutChange instead

See the README for detailed examples


Configuration

📅 Schedule: Branch creation - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday ( * 0-4,22-23 * * 1-5 ), Only on Sunday and Saturday ( * * * * 0,6 ) in timezone Europe/Paris, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added dependencies use for pull requests that update a dependency file filigran team use to identify PR from the Filigran team labels Dec 17, 2025
@renovate renovate bot force-pushed the renovate/react-grid-layout-2.x branch from d64127a to aeefb33 Compare December 18, 2025 02:38
@renovate renovate bot force-pushed the renovate/react-grid-layout-2.x branch 2 times, most recently from 7e5a6e6 to 8b13c67 Compare December 31, 2025 21:09
@renovate renovate bot force-pushed the renovate/react-grid-layout-2.x branch 2 times, most recently from d1cff03 to 4d7e956 Compare January 3, 2026 02:06
@damgouj damgouj self-requested a review January 16, 2026 15:18
@renovate renovate bot force-pushed the renovate/react-grid-layout-2.x branch 2 times, most recently from 33dd41f to ebcd8fc Compare February 2, 2026 21:34
@renovate renovate bot force-pushed the renovate/react-grid-layout-2.x branch from ebcd8fc to 360580b Compare February 12, 2026 23:46
@renovate renovate bot force-pushed the renovate/react-grid-layout-2.x branch from 360580b to c2cdb38 Compare February 17, 2026 21:51
@renovate
Copy link
Contributor Author

renovate bot commented Feb 27, 2026

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.35%. Comparing base (8ae82b9) to head (832f4c9).
⚠️ Report is 28 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4588      +/-   ##
============================================
+ Coverage     55.55%   56.35%   +0.80%     
- Complexity     4378     4574     +196     
============================================
  Files           983      999      +16     
  Lines         29156    29990     +834     
  Branches       2131     2274     +143     
============================================
+ Hits          16197    16901     +704     
- Misses        12022    12110      +88     
- Partials        937      979      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@damgouj damgouj merged commit 7e6f370 into master Feb 27, 2026
13 checks passed
@damgouj damgouj deleted the renovate/react-grid-layout-2.x branch February 27, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies use for pull requests that update a dependency file filigran team use to identify PR from the Filigran team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant